module.exports = (app) => {
  const {
    STRING, INTEGER, DATE, TEXT
  } = app.Sequelize;

  const Feedback = app.model.define('feedbacks', {
    id: { type: INTEGER, primaryKey: true, autoIncrement: true },
    uuid: { type: STRING(36), unique: true },
    FKConclusion: { type: INTEGER, field: 'fk_conclusion' },
    upper: { type: INTEGER },
    lower: { type: INTEGER },
    description: { type: TEXT },
    createdAt: { type: DATE, field: 'created_at' },
    updatedAt: { type: DATE, field: 'updated_at' },
  },
  {
    tableName: 'feedbacks'
  });

  Feedback.associate = () => {
    app.model.Feedback.belongsTo(app.model.Conclusion, {
      foreignKey: 'fk_conclusion',
      targetKey: 'id',
    });
  };

  return Feedback;
};
